package com.example.zhaoping.controller;

import com.example.zhaoping.domain.ResponseResult;
import com.example.zhaoping.dto.UserLoginDto;
import com.example.zhaoping.enums.AppHttpCodeEnum;
import com.example.zhaoping.exception.SystemException;
import com.example.zhaoping.service.IUserService;
import com.example.zhaoping.vo.UserLoginVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/login")
@RestController
@Api(tags = "登录模块")
public class UserLoginController {
    @Autowired
    private IUserService userService;
    @PostMapping("/user")
    @ApiOperation("登录页面")
    public ResponseResult login(@RequestBody UserLoginDto userLoginDto){

        String username = userLoginDto.getUsername();
        String password = userLoginDto.getPassword();
        UserLoginVo userLoginVo= userService.login(username,password);
        return ResponseResult.okResult(userLoginVo);
    }
}
